// @ts-expect-error
import { buildVersion } from 'virtual:website-config';

// @TODO: Get rid of the hardcoded initial path, always source cwd from the client.
export const DEFAULT_WORKSPACE_DIR = '/wordpress/workspace';
export const DEFAULT_URL_PREFIX = '/workspace';

export const DEFAULT_CODE = `<?php
echo "Hello from PHP " . phpversion();
echo "<br>";

// WordPress is available if you need it!
require '/wordpress/wp-load.php';

echo "WordPress " . wp_get_wp_version() . "<br>";

$html_processor = WP_HTML_Processor::create_fragment('<p><span>Hey!</span></p>');
$html_processor->next_tag();
var_dump($html_processor->get_tag());
?>`;

export function getRemoteUrl() {
	const remoteUrl = new URL(window.location.origin);
	remoteUrl.pathname = '/remote.html';
	remoteUrl.searchParams.set('v', buildVersion);
	return remoteUrl;
}
